package com.ruoyi.web.core.config;

import cn.binarywang.wx.miniapp.api.WxMaService;
import com.tencentcloudapi.common.Credential;
import lombok.Data;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * TODO
 *
 * @author chenchuan2
 * @date 2023-01-13 00:04:35
 */
@Data
@Configuration
@ConditionalOnClass(WxMaService.class)
@ConfigurationProperties(prefix = "wechat.cloud")
public class TencentCloudClient {

    private String secretId;

    private String secretKey;

    @Bean
    @ConditionalOnMissingBean(Credential.class)
    public Credential createCredential() {
        Credential cred = new Credential(secretId, secretKey);
        return cred;
    }

}
